package core.queue;

import core.Queue;

public class BackActions {
    private QueueAction before = null;
    private QueueAction after = null;

    public void setOnBefore(QueueAction before){
        this.before = before;
    }

    public void setOnAfter(QueueAction after){
        this.after = after;
    }

    public boolean doAction(Queue queue, boolean after){
        if(after && this.after != null){
            return this.after.apply(queue);
        }else if(!after && this.before != null){
            return this.before.apply(queue);
        }
        return false;
    }
}
